package interaction

import (
	"github.com/gin-gonic/gin"
	"gogs.xiaoyuanjijiehao.com/antlinker/antcms/app/ginsrv/oplog"
	"gogs.xiaoyuanjijiehao.com/antlinker/antcms/core"
)

// Init 初始化
func Init(route *gin.RouterGroup, d core.CmsDomain) {
	ctrl := createCtrl(d)
	// route.GET("replays", ctrl.getInfoPageList)
	// route.GET("infos/:infoid", info.getInfo)

	route.POST("replays", oplog.OplogRoute("api发布评论", "cms/api/replay/add", ctrl.replay))
	route.GET("replays/first/:igid", ctrl.replayFirstPageList)
	route.GET("replays/hot/:igid", ctrl.replayHostPageList)
	route.GET("replays/children/:parentid", ctrl.replayChildrenPageList)
	route.GET("replays/detail/:replayid", ctrl.queryReplayByID)
	route.GET("groups/:igid", ctrl.getGroupinfo)
	route.POST("infos", oplog.OplogRoute("api发布互动信息", "cms/api/ints/infos/add", ctrl.postInfos))
	route.GET("infos/:columnid", ctrl.queryPageInfos)
	route.GET("infos/:columnid/:infoid", ctrl.queryInfo)
	route.GET("infoscount/:columnid", ctrl.queryInfoCount)
	route.GET("my/:columnid/infos", ctrl.queryPageMyInfos)
	route.GET("other/:columnid/:uid", ctrl.queryPageOtherInfos)

	route.PUT("op/:code", oplog.OplogRoute("api指定互动类型的交互操作", "cms/api/ints/op/do", ctrl.putOp))
	route.GET("op", ctrl.queryPageOps)
	route.GET("op/:code", ctrl.queryPageOpsByCode)
	route.GET("op/:code/my", ctrl.queryPageMyOpsByCode)

	route.PUT("colls/:typ/:id", oplog.OplogRoute("api收藏指定内容", "cms/api/ints/colls/do", ctrl.putColl))
	route.DELETE("colls/:typ/:id", oplog.OplogRoute("api取消收藏指定内容", "cms/api/ints/colls/delete", ctrl.deleteColl))
	route.GET("colls", oplog.OplogRoute("api获取我的收藏", "cms/api/ints/colls/queryMy", ctrl.queryPageMyColl))
	route.PUT("likes/:typ/:id", oplog.OplogRoute("api指定内容点赞", "cms/api/ints/likes/do", ctrl.putLike))
	route.DELETE("likes/:typ/:id", oplog.OplogRoute("api指定内容取消点赞", "cms/api/ints/likes/delete", ctrl.deleteLike))
	route.GET("likes/:typ/:id", oplog.OplogRoute("api获取点赞列表的交互操作", "cms/api/ints/likes/list", ctrl.queryPageLikeByCode))

	route.PUT("follow/:id", oplog.OplogRoute("api关注指定用户", "cms/api/ints/follow/do", ctrl.putFollow))
	route.DELETE("follow/:id", oplog.OplogRoute("api取消关注指定用户", "cms/api/ints/follow/delete", ctrl.deleteFollow))
	route.GET("myfollow", oplog.OplogRoute("api获取我的关注", "cms/api/ints/queryMyfollow", ctrl.queryPageMyFollow))
	route.GET("myfans", oplog.OplogRoute("api获取我的粉丝", "cms/api/ints/queryMyFans", ctrl.queryPageMyFans))
	route.GET("userfollows/:uid", oplog.OplogRoute("api获取他人的关注信息", "cms/api/ints/userfollows", ctrl.queryUserFollow))
	route.GET("mynums", oplog.OplogRoute("api获取我的互动信息", "cms/api/ints/mynums", ctrl.queryMyNums))
}
